package com.tencent.qf.team.controller;

import com.tencent.qf.common.aspect.annotation.ApiLog;
import com.tencent.qf.common.pojo.HttpResult;
import com.tencent.qf.team.dal.DmAppCostCenterLevelDetail;
import com.tencent.qf.team.dal.DmAppCostCenterTaskDetail;
import com.tencent.qf.team.dto.request.DmAppCostCenterLevelDetailRequest;
import com.tencent.qf.team.dto.request.DmAppCostCenterTaskDetailRequest;
import com.tencent.qf.team.service.CostCenterService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@Api(value = "成本中心")
public class CostCenterController {

    @Autowired
    private CostCenterService costCenterService;

    @PostMapping("/api/team/costCenter/levelDetail")
    @ApiLog("成本中心等级明细")
    public HttpResult<List<DmAppCostCenterLevelDetail>> levelDetail(
            @RequestBody DmAppCostCenterLevelDetailRequest request) {
        List<DmAppCostCenterLevelDetail> list = costCenterService.levelDetail(request);
        return HttpResult.success(list);
    }

    @PostMapping("/api/team/costCenter/taskDetail")
    @ApiLog("成本中心任务统计")
    public HttpResult<List<DmAppCostCenterTaskDetail>> taskDetail(
            @RequestBody DmAppCostCenterTaskDetailRequest request) {
        List<DmAppCostCenterTaskDetail> list = costCenterService.taskDetail(request);
        return HttpResult.success(list);
    }
}
